-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deps: update extractErrors plugin to Babel 7 and more #878
deps: update extractErrors plugin to Babel 7 and more #878
Conversation
- this plugin is largely borrowed from the React monorepo, consistently add FB's License headers to each file, not just to extractErrors.ts - also add comments pointing to the exact file and commit that each file was copied from - most of these are slightly out of date now: - evalToString is missing a line - extractErrors needs to be updated to Babel 7 - babylon -> @babel/parser, babel-traverse -> @babel/traverse - transformErrorMessages has several new constructs added :/... - keeping a pseudo-fork up-to-date is pretty tedious and not very maintainble (it's also broken per the tests I've added) - would be better if we could ask FB to split out theirs as a separate package...
- whitespace errors in extractErrors - unnecessary Flow comments in invertObject when we're using TS - also inconsistent, it looks like they've been removed and replaced with TS elsewhere - here TS types were added but Flow was also left in
- this was using Babel 6's Babylon and babel-traverse, which meant two different versions of Babel were being used and a lot of unnecessary deps were in the tree - now there should no longer be any Babel 6 deps in the tree - also transformErrorMessages was already using Babel 7 (`@babel/helper-module-imports`) while extractErrors was on Babel 6 just for extra inconsistency 😬 - these two files seemed to be updated at the same time to Babel 7 as far as I can tell though 🤨 - `@babel/parser` ships its own typings now, so no need to use the `declare module` workaround for it anymore - but did have to add a type-cast as its usage doesn't entirely fit the type 😕 - this also helps remove an old version of core-js v2, the addition of which would give a deprecation warning on install: - "npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3."
- a line was added upstream in the last year, so add it here too to be up-to-date - now only transformErrorMessages is out-of-date ...but there's a little too many changes for me to really prioritize right now
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/formium/tsdx/pwyf5dy7m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 . Dependency removal gr8
Description
This plugin was out-of-date by a good bit, so have updated a good bit to a more current version.
Commits
license: add FB License header to all extractErrors code
this plugin is largely borrowed from the React monorepo, consistently
add FB's License headers to each file, not just to extractErrors.ts
also add comments pointing to the exact file and commit that each
file was copied from
maintainble (it's also broken per the tests I've added)
separate package...
clean: bad whitespace and Flow types in extractErrors
with TS elsewhere
deps: update extractErrors Babel plugins to Babel 7
this was using Babel 6's Babylon and babel-traverse, which meant two
different versions of Babel were being used and a lot of unnecessary
deps were in the tree
(
@babel/helper-module-imports
) while extractErrors was on Babel 6just for extra inconsistency 😬
as far as I can tell though 🤨
@babel/parser
ships its own typings now, so no need to use thedeclare module
workaround for it anymorethe type 😕
this also helps remove an old version of core-js v2, the addition of
which would give a deprecation warning on install:
EDIT: forgot to mention I also checked the Babel 7 migration guide which mentions
babel-traverse
,babylon
, and AST changes in general, which all seemed compatible to me (and React team must have checked it already too).deps: update extractErrors plugin's evalToString file
up-to-date
little too many changes for me to really prioritize right now
Tags
Follow-up to #138 I suppose
Some React PRs that updated this part of their monorepo:
@babel/parser
: Use babel parser rather than Babylon in extract errors facebook/react#17988Literal
addition inevalToString
: Use console directly instead of warning() modules facebook/react#17599TODO to be added to
transformErrorMessages
... well I'd prefer asking FB/React to split out their code as a separate package than maintaining this though:In tandem with #795 which removed the unused
@babel/polyfill
dep (and itscore-js
v2 dep), this should remove the last deprecation warning I know of that TSDXv0.13.3
has from #789 (comment) by removing the lastcore-js
v2 usage: